feat: 添加实例列表右键编辑功能 (#6000)#6038
Open
NWMA-FYWF wants to merge 2 commits intoHMCL-dev:mainfrom
Open
Conversation
NWMA-FYWF
commented
May 2, 2026
- 实例列表项支持右键编辑
- 编辑页面名称唯一性验证排除自身
- 路径变化后不再自动修改名称
- 实例列表项支持右键编辑 - 编辑页面名称唯一性验证排除自身 - 路径变化后不再自动修改名称
Author
Glavo
reviewed
May 6, 2026
Member
Glavo
left a comment
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
| txtProfileName.textProperty().removeListener(txtProfileNameChangeListener); | ||
|
|
||
| if (profile != null) { | ||
| profile.setName(txtProfileName.getText()); |
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
编辑现有实例时,名称输入框使用 Profiles.getProfileDisplayName(profile) 初始化,但保存时又把 txtProfileName.getText() 写回 profile.setName(...)。这会让 Default / Home 这类保留名称在非英文语言下被保存成翻译后的显示名。触发条件是右键编辑默认/主目录实例后直接保存,哪怕只改路径或相对路径开关。结果是配置 key 被改掉,内置实例失去保留名称身份。建议编辑框使用 profile.getName() 作为真实名称,显示名只用于列表/标题展示。
| } | ||
|
|
||
| ChangeListener<String> locationChangeListener = (observable, oldValue, newValue) -> { | ||
| locationChangeListener = (observable, oldValue, newValue) -> { |
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
locationChangeListener 仍然在编辑模式注册。右键编辑现有实例后,如果用户先把实例目录改到某个 .../.minecraft 路径,监听器会把名称输入框自动改成父目录名,保存时就会静默重命名实例。这和 PR 描述里的“路径变化后不再自动修改名称”不一致。建议只在 profile == null 的新建流程中启用这个自动命名监听器,或进入编辑模式时直接禁用它。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
